#pragma once
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "InnerType.h"

namespace xncc {
namespace foundation {
    class EventLoop;
    class XnccAddress;
    class XnccServer
    {
      public:
        explicit XnccServer(const std::set<std::string>& list = {});
        virtual ~XnccServer() = default;

        XnccServer(const XnccServer&&)            = delete;
        XnccServer(const XnccServer&)             = delete;
        XnccServer& operator=(const XnccServer&)  = delete;
        XnccServer& operator=(const XnccServer&&) = delete;

        virtual void init()  = 0;
        virtual void start() = 0;

        [[nodiscard]] virtual auto Type() const -> shared::XNCC_SERVER_TYPE = 0;

        static XnccServer* CreateXnccServer(EventLoop*,
                                            std::shared_ptr<XnccAddress>,
                                            const std::string&,
                                            const std::set<std::string>& list = {});
        static void        Destory(XnccServer*);

        void addSubServerLoop(EventLoop* loop) { subServerLoops_.push_back(loop); }

      protected:
        std::set<std::string>   blacklist_;
        std::vector<EventLoop*> subServerLoops_;
    };
}  // namespace foundation
}  // namespace xncc